﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.IO;
using Newtonsoft.Json;

namespace LLog.Web
{
    public class MigrationConfig
    {
        public static MigrationConfig Instance = new MigrationConfig();
        public MigrationOption MigrationOption { get; }
        private MigrationConfig()
        {
            using (var sr = new StreamReader("migration.json"))
                MigrationOption = JsonConvert.DeserializeObject<MigrationOption>(sr.ReadToEnd());
        }
        public List<Update> GetUpdates()
        {
            return MigrationOption.Updates;
        }
    }

    public class MigrationOption
    {
        public bool Auto { set; get; }
        public List<Update> Updates { set; get; }

    }
    public class Update
    {
        public string Version { set; get; }
        public string Desc { set; get; }

    }
}
